package com.zyg.manager.controller;

import com.zyg.manager.entity.ContentEntity;
import com.zyg.manager.service.ContentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

/**
 * 功能：
 * 作者： fufeixiang
 * 日期： 2021-12-03
 */
@Controller
@RequestMapping
public class IndexController {
    @Autowired
    private ContentService contentService;
    //默认页面
    @GetMapping({"/","/index.html"})
    public String index(Model model){
        //查询出广告列表
        List<ContentEntity> contentEntities = contentService.findAll();
        //放到model中
        model.addAttribute("contentList",contentEntities);
        return "index";
    }

}
